home *** CD-ROM | disk | FTP | other *** search
- #include "VCRplus.h"
-
- extern vcrInfo myVCR;
-
- void encoder(void)
- {
- long j, doneflag, tblidx ;
- long s1_out, bot3, top5, quo, rem ;
- long s4_out, s5_out, ofout ;
- Str32 codeText;
-
-
- /* get the t bits and the c bits */
- tblidx = lookup2(myVCR.startTime, myVCR.duration);
-
- /* from them infer what must have been step 4 & step 5 results */
- interleave(tblidx, myVCR.channel - 1, (&s4_out), (&s5_out)) ;
-
- /* find the smallest unmapped_top giving correct mapped_top */
- top5 = 0;
- doneflag = 0;
-
- /* if the mapped_top is zero then top and offset are zero */
- if(s4_out == 0) { top5 = 0; ofout = 0; doneflag = 1; }
-
- while(doneflag == 0)
- {
- top5++;
- offset(myVCR.day, myVCR.year, top5, (&ofout), (&j)) ;
- if(j == s4_out) doneflag = 1;
- }
-
- /* have two of the three inputs to step 5; determine the rem */
- for(rem=0; rem<32; rem++)
- {
- j = (rem + (myVCR.day*(myVCR.month+1)) + ofout) % 32 ;
- if(j == s5_out) break ;
- }
- quo = (myVCR.day - 1);
-
-
- /* assemble the output of step 1 */
- bot3 = 1 + rem + (32 * quo) ;
- s1_out = bot3 + (1000 * top5) ;
-
- /* invert the mixing */
- myVCR.code = f1(s1_out);
- NumToString(myVCR.code, codeText);
-
- SetDText(dlgPLUSCODE, codeText);
-
- return;
- }
-
-